package star.基础.俩栈实现队列;

import java.util.Stack;

public class CQueue {
    Stack<Integer> A;
    Stack<Integer> B;

    public CQueue() {
        A = new Stack<>();
        B = new Stack<>();
    }

    public void appendTail(int value) {
        A.push(value);
    }

    public int deleteHead() {
        while(!A.empty()){
            B.push(A.pop());
        }
        int result = B.empty() ? -1 : B.pop();
        while(!B.empty()){
            A.push(B.pop());
        }
        return result;
    }
}
